<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" id="i1" placeholder="员工姓名">
<input type="text" id="i2" placeholder="员工工资">
<input type="text" id="i3" placeholder="员工工作">
<input type="button" value="添加" onclick="f()">
<table border="1">
  <caption>员工列表</caption>
  <tr><th>姓名</th><th>工资</th><th>工作</th></tr>
</table>
<script>
  let i1 = document.querySelector("#i1");
  let i2 = document.querySelector("#i2");
  let i3 = document.querySelector("#i3");
  let table = document.querySelector("table");
  function f() {
    //创建tr和td
    let tr = document.createElement("tr");
    let nameTd = document.createElement("td");
    let priceTd = document.createElement("td");
    let jobTd = document.createElement("td");
    //给td赋值
    nameTd.innerText = i1.value;
    priceTd.innerText = i2.value;
    jobTd.innerText = i3.value;
    //把td装进tr, 把tr装进table
    tr.append(nameTd,priceTd,jobTd);
    table.append(tr);
  }
</script>
</body>
</html>